Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix printing of array types in JSpecify errors #1145

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

msridhar
Copy link
Collaborator

@msridhar msridhar commented Feb 9, 2025

Before we would not print nullability of the top-level array type. Also improve spacing.

Copy link

codecov bot commented Feb 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.23%. Comparing base (50cb4ab) to head (d876f8f).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1145   +/-   ##
=========================================
  Coverage     88.22%   88.23%           
- Complexity     2260     2261    +1     
=========================================
  Files            85       85           
  Lines          7312     7318    +6     
  Branches       1461     1462    +1     
=========================================
+ Hits           6451     6457    +6     
  Misses          432      432           
  Partials        429      429           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -596,7 +595,7 @@ public void varargsOverride() {
" }",
" static class NullableVarargsBothImpl3 implements NullableVarargsBoth {",
" @Override",
" // BUG: Diagnostic contains: Parameter has type Object[]",
" // BUG: Diagnostic contains: Parameter has type Object @Nullable []",
Copy link
Collaborator

@akshayutture akshayutture Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the diagnostic say "Object @nullable []" now instead of "Object []" because the default behavior is that un-annotated parameters are nullable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we just weren't printing the type properly at all before. If we have a varargs parameter Object @Nullable... params, the type of the params array is Object @Nullable []. We're just fixing a serious bug in printing types in error messages.

@msridhar msridhar merged commit 7fa7bf9 into master Feb 10, 2025
12 checks passed
@msridhar msridhar deleted the fix-jspecify-array-error-msg-2025-02-09 branch February 10, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants